/*
 * main.cpp
 *
 *  Created on: 03/06/2011
 *      Author: dela
 */

#include <string>
#include <iostream>
#include <stdlib.h>
#include <gtkmm.h>
#include "common/view/Login.h"
#include "common/Connection.h"
#include "common/Course.h"
#include "common/Class.h"

using namespace std;

Connection *Connection::conn = NULL;

/**
 *
 */
int main(int argc, char *argv[]) {
	// Si es incorrecta la cantidad de parametros salgo:
	if ( argc != 3 ) {
		cout << "Parametros esperados: ip y puerto." << endl;
		return -1;
	}
	int iport = atoi(argv[2]);

	Connection::createSingleton(argv[1], iport);
	Connection::getInstance()->initConnection();
	Connection::getInstance()->setType('S');


	// GTK:
	Gtk::Main kit(argc, argv);

	Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("glade/student/login.glade");

	Login* login = 0;
	builder->get_widget_derived("window1", login);
	kit.run( *login );

	cout << "Desconectando..." << endl;
}

